#include "effect.h"
#include <QtGui/QApplication>
#include <QtGui>

int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	//effect w;
	//w.show();
	QGraphicsView gv;
	QPixmap pix("internet-web-browser.png");
	QGraphicsScene *scene = new QGraphicsScene(&gv);
	QGraphicsPixmapItem *icon = scene->addPixmap(pix);

	icon->setZValue(1);
	BlurEffect blur;
	blur.setBlurRadius(0);
	icon->setGraphicsEffect(&blur);

	QPropertyAnimation animation(&blur,"radius");
	animation.setDuration(10000);
	animation.setStartValue(1);
	animation.setEndValue(50);
	animation.start();


	QFont font;
	font.setPointSize(font.pointSize() * 2);
	font.setBold(true);

	QGraphicsTextItem *text = scene->addText("what the fk ru doing");
	text->setDefaultTextColor(Qt::red);
	text->setPos(-110, -110);

	//QGraphicsRectItem *parent = scene->addRect(100, 100, 100, 100);
	//parent->setPen(Qt::NoPen);
	//parent->setZValue(0);

	//QGraphicsPixmapItem *bg = scene->addPixmap(QPixmap("kinetic.png"));
	//bg->setParentItem(parent);
	//bg->setZValue(-1);

	QGraphicsColorizeEffect* m_effect = new QGraphicsColorizeEffect;
	m_effect->setColor(QColor(255, 0, 0));
	m_effect->setStrength(10);
	m_effect->setEnabled(true);
	text->setGraphicsEffect(m_effect);


	QPropertyAnimation animation2(m_effect,"color");
	animation2.setDuration(10000);
	animation2.setStartValue(QColor(255, 0, 0));
	animation2.setEndValue(QColor(0, 0, 255));
	animation2.start();


	QGraphicsEllipseItem* item = new QGraphicsEllipseItem(0, 0, 50, 50);
	item->setPen(QPen(Qt::black, 1));
	item->setBrush(QBrush(Qt::white));
	QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect;
	effect->setBlurRadius(8);
	effect->setOffset(3,4);
	 effect->setColor(QColor(0,255,0));
	item->setGraphicsEffect(effect);
	item->setZValue(1);
	item->setPos( 0,  -200);
	scene->addItem(item);

	QPropertyAnimation animation3(effect,"offset");
	animation3.setDuration(10000);
	animation3.setStartValue(QPointF(3,4));
	animation3.setEndValue(QPointF(-4,-3));
	animation3.start();

	QPropertyAnimation animation4(effect,"color");
	animation4.setDuration(10000);
	animation4.setStartValue(QColor(0, 0, 255));
	animation4.setEndValue(QColor(255, 0, 0));
	animation4.start();
	
	QGraphicsOpacityEffect * eff = new QGraphicsOpacityEffect( &gv );
	eff->setOpacity( 1 );
	gv.setGraphicsEffect(eff);

	QPixmap pix2("kinetic.png");
	QGraphicsPixmapItem *icon2 = scene->addPixmap(pix2);
	icon2->setPos(-300,-300);
	icon2->setGraphicsEffect(eff);
	icon2->setFlag(QGraphicsItem::ItemIsMovable);


	QPropertyAnimation animation5(eff,"opacity");
	animation5.setDuration(10000);
	animation5.setStartValue(1);
	animation5.setEndValue(0.1);
	animation5.start();

	gv.setScene(scene);
	gv.setFixedSize(500,500);
	gv.show();

	return a.exec();
}
